package com.wctj.api.web.controller.platform;

import com.wctj.api.base.Result;
import com.wctj.api.base.annotation.CheckSign;
import com.wctj.api.base.annotation.SysLog;
import com.wctj.api.business.common.dto.PlatformConfigAddDTO;
import com.wctj.api.business.common.dto.PlatformConfigQueryDTO;
import com.wctj.api.business.common.dto.PlatformConfigSDeleteDTO;
import com.wctj.api.business.common.dto.PlatformConfigSaveDTO;
import com.wctj.api.business.common.service.DdwxPaymentCfgInfoService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
* @Description: 平台支付参数配置相关的controller
* @Author: lydms
* @Date: 2024/10/26
*/
@Slf4j
@RestController
@RequestMapping(value = "platform")
@Api(tags = "平台管理接口")
public class PlatformController {

    @Resource
    private DdwxPaymentCfgInfoService ddwxPaymentCfgInfoService;

    //增删改查
    /**
     * 获取 平台支付参数配置列表
     * @param platformConfigQueryDTO
     * @return
     */
    @SysLog("获取平台支付参数配置列表")
    @PostMapping(value = "getPlatformConfigList")
    @CheckSign
    public Result<Object> getPlatformConfigList(@RequestBody @Valid PlatformConfigQueryDTO platformConfigQueryDTO) {
        return ddwxPaymentCfgInfoService.getPlatformConfigList(platformConfigQueryDTO);
    }

    /**
     * 编辑修改 平台支付参数配置
     * @param platformConfigSaveDTO
     * @return
     */
    @SysLog("编辑修改平台支付参数配置")
    @PostMapping(value = "savePlatformConfig")
    @CheckSign
    public Result<Object> savePlatformConfig(@RequestBody @Valid PlatformConfigSaveDTO platformConfigSaveDTO) {
        return ddwxPaymentCfgInfoService.savePlatformConfig(platformConfigSaveDTO);
    }

    /**
     * 新增平台支付参数配置
     * @param platformConfigAddDTO
     * @return
     */
    @SysLog("新增平台支付参数配置")
    @PostMapping(value = "addPlatformConfig")
    @CheckSign
    public Result<Object> addPlatformConfig(@RequestBody @Valid PlatformConfigAddDTO platformConfigAddDTO) {
        return ddwxPaymentCfgInfoService.addPlatformConfig(platformConfigAddDTO);
    }

    /**
     * 删除 平台支付参数配置
     * @param platformConfigSDeleteDTO
     * @return
     */
    @SysLog("删除平台支付参数配置")
    @PostMapping(value = "deletePlatformConfig")
    @CheckSign
    public Result<Object> deletePlatformConfig(@RequestBody @Valid PlatformConfigSDeleteDTO platformConfigSDeleteDTO) {
        return ddwxPaymentCfgInfoService.deletePlatformConfig(platformConfigSDeleteDTO);
    }

}
